﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chinaer.Common.Extensions
{
    public static class LinqExtensions
    {
        public static bool IsUseTrue(this Model.Entities.Model_Base modelBase)
        {
            return modelBase.IsUse == true;
        }

        public static bool IsDeleteFalse(this Model.Entities.Model_Base modelBase)
        {
            return modelBase.IsDelete == false;
        }
        public static bool IsUseTrueAndDeleteFalse(this Model.Entities.Model_Base modelBase)
        {
            if (modelBase == null)
            {
                return false;
            }
            return modelBase.IsUse == true && modelBase.IsDelete == false;
        }
        /// <summary>
        /// 如果实体为Null 则抛出异常信息
        /// </summary>
        /// <param name="modelBase"></param>
        public static void IsModelBaseNullThrowException(this Model.Entities.Model_Base modelBase)
        {
            //if (modelBase == null)
            //{
            //    Chinaer.Core.Helper.ExceptonHelper.ThrowException(modelBase.GetType()+"实体为NUll");
            //}
        }
      
    }
}
